<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="jt.classic.system.ISystem"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@include file="./../hys_head.jsp"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[]) request.getAttribute("result");
	Label label = (Label) result[1];
	Controller controller = (Controller) result[2];
	String pageNO = (String) result[3];
	List resultList = (List) result[0];

	IUser user = ISystem.getSessionUser(request);

	String hname = (String) request.getAttribute("hname");
	String hdate = (String) request.getAttribute("hdate");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>会议室申请列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../../head.jsp"></jsp:include>
<script language="javascript">

  //重新提交会议室申请
  function handleEdit1(id){
      var url = "<%=context%>/app/hysyd.do?method=edit&id=" + id;
      window.location.href = url;
  }
  
  //会议室申请查看
  function handleView(id){
      var url = "<%=context%>/app/hysyd.do?method=view&id=" + id;
      top.xwin(this,url,true,"",900,550);
  }
  
  //会议室申请编辑
  function handleEdit(id){
      var url = "<%=context%>/app/hysyd.do?method=edit&id=" + id;
      window.location.href = url;
  }

  var chk = false;
  function checkall(thizz){
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox"){
        chks[i].checked = !chk;
      }
    }
    
    chk = !chk;
  }
  
  function handleDelete(){
    var rnt = false;
    var ids = "";
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox" && chks[i].checked){
        rnt = true;
        ids += chks[i].value + ",";
      }
    }
    
    if(!rnt){
      alert("请选择要删除申请");
    }else if(confirm("确定删除申请")){
      createHidden("ids",ids.substring(0,ids.length - 1));
      document.form1.action = "<%=context%>/app/hysyd.do?method=delete";
      document.form1.submit();
    }
  }
  
  function handleQuery(){
     document.form1.action = context + "/app/hysyd.do?method=list";
     document.form1.submit();
  }
  
  function handleInsert(){
      var url = "<%=context%>/app/hysyd.do?method=neu";
      window.location.href = url;
  }
   
  function handleReresh(){
      window.location.href = context + "/app/hysyd.do?method=list&pageNO=<%=pageNO%>";
  }
</script>
<body>
<form name="form1" method="post" action=""><input type="hidden"
	name="pageNO" value="<%=pageNO%>">
会议室 <input type="text" style="width:200px;" class="box3"
			name="hname" value="<%=hname%>"> 申请时间 <input style="width:100px;" type="text"
			class="box3" name="hdate" readonly value="<%=hdate%>"
			onclick="HS_setDate(this)"> 
			<img src="/app/info/images/search.png" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleQuery();"/>查 询
			<img src="/app/info/images/addinfo.png" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleInsert();"/>预定申请
			<img src="/app/info/images/page_white_delete.png" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleDelete();"/>删 除
<table class="tbl" align="center" width="800">
<thead>
	<tr>
		<td class="td1" title="全部选择/取消选择" onclick="javascript:checkall();"
			width="10" align="center">&nbsp;</td>
		<td class="td1" width="10%">&nbsp;会议编号</td>
		<td class="td1" width="30%">&nbsp;会议主题</td>
		<td class="td1" width="10%">&nbsp;地点</td>
		<td class="td1" width="10%">&nbsp;申请人</td>
		<td class="td1" width="15%">&nbsp;开始时间</td>
		<td class="td1" width="10%">&nbsp;审批意见</td>
		<td class="td1" width="10%">&nbsp;处理状态</td>
	</tr>
	</thead>
	<%
			if (resultList != null && !resultList.isEmpty()) {

			for (int i = 0; i < resultList.size(); i++) {
				Map info = (Map) resultList.get(i);
				String number = (String) info.get("PAGINATION_NUMBER");
				String HYSYD_ID = info.get("HYSYD_ID").toString();

				String HYSYD_HYBH = info.get("HYSYD_HYBH").toString();
				String HYSYD_ZT = info.get("HYSYD_ZT").toString();

				String HYSYD_HYSID = info.get("HYSYD_HYSID").toString();
				String HYS_MC = info.get("HYS_MC").toString();

				String CREATE_USER = info.get("CREATE_USER").toString();
				String NAME = info.get("NAME").toString();

				String HYSYD_KSSJ = info.get("HYSYD_KSSJ").toString();
				String HYSYD_SPYJ = info.get("HYSYD_SPYJ").toString();
				String HYSYD_SPZT = info.get("HYSYD_SPZT").toString();

				String url = null;

				if (ISystem.matchrole(user, "hysadmin")
				|| ISystem.matchrole(user, "admin")) {
			url = context + "/app/hysyd.do?method=edit&id="
					+ HYSYD_ID;
				} else {
			url = context + "/app/hysyd.do?method=view&id="
					+ HYSYD_ID;
				}
	%>
	<tr onMouseOver="javascript:this.bgColor='#ffff99'"
		onmouseout=" javascript:this.bgColor='#ffffff'" bgColor="#ffffff">
		<td class="td1" align="center">
		<%
		//if(!"1".equals(HYSYD_SPZT)){
		%> <input type="checkbox" name="chk"
			value="<%=HYSYD_ID%>"> <%
 //}else{
 %> &nbsp; <%
 //}
 %>
		</td>
		<td>&nbsp;<%=HYSYD_HYBH%></td>
		<td>&nbsp;<a href="<%=url%>"><%=HYSYD_ZT%></a></td>
		<td>&nbsp;<%=HYS_MC%></td>
		<td>&nbsp;<%=NAME%></td>
		<td>&nbsp;<%=DateUtilMy.getNYR_H_M_S(HYSYD_KSSJ)%></td>
		<td>&nbsp;<%=HYSYD_SPYJ%></td>
		<td>&nbsp; <%
 if ("1".equals(HYSYD_SPZT)) {
 %><font
			color="red">
		<%
		}
		%> <%=Hys_Code.getSPZT(HYSYD_SPZT, HYSYD_ID)%> <%
 if ("1".equals(HYSYD_SPZT)) {
 %>
		</font>
		<%
		}
		%>
		</td>

	</tr>
	<%
		}
		}
	%>
</table>
<table width="98%" class="tab-noborder" align="center">
	<tr>
		<td><%=label.displayLabel()%></td>
		<td align="right"><%=label.startLabel()%> <%=label.previousLabel()%>
		<%=label.nextLabel()%> <%=label.endLabel()%> <%=controller.getController().toString()%>
		</td>
	</tr>
</table>
<%=controller.getControlScript(true)%></form>
</body>
</html>
